<template>
  <div>
    <image class="bgimg" src="root:img/bg.png" resize="cover" />
   
    <scroller class="wrappes">
       <div class="leftIcon" @click="back()">
      <text class="arricon">&#xe603;</text>
    </div>
      <text class="emailtitle">Change phone number</text>

      <div class="inputBox bb">
        <text class="phoneType">+61</text>
        <input
          type="tel"
          v-model="phone"
          class="input"
          placeholder="New phone number"
          placeholder-color="#F2f2f2"
        />
      </div>
      <text class="singnIn" @click="send_verify_code">Next step</text>
    </scroller>
    <div v-if="loading" class="mask" @click="event=> event.stopPropagation()">
      <floading class="indicator" color="#303030"></floading>
    </div>
  </div>
</template>

<script>
const pref = weex.requireModule("storage");
import { send_verify } from "../../mixin/ajax.js";
export default {
  data() {
    return {
      loading: false,
      phone: "",
      loginType: "email"
    };
  },

  methods: {
    send_verify_code() {
      let that = this;
      if (!that.phone) {
        that.toast("Enter your phoneNumber");
        return false;
      }
      let refs = /^(\+?61|04|4)\d{8}$/;
      if (!refs.test(that.phone)) {
        that.toast("Mobile phone number is not standard");
        return false;
      }
      this.loading = true;
      send_verify(
        {
          mobile: that.phone,
          type: "5" // 绑定手机号
        },
        (res, flag) => {
          this.loading = false;
          if (flag) {
            if (res.code == "200") {
              that.push("root:app/login/vertifyCode.js", { phone: that.phone });
            } else {
              that.toast(res.message);
            }
          }
        }
      );
    },
    next() {}
  }
};
</script>

<style scoped>
.bgimg {
  flex: 1;
}

.iconfont {
  font-family: iconfont;
}

.inputIcon {
  font-size: 30px;
  color: #ffffff;
  width: 60px;
  text-align: left;
}
.leftIcon {
  position: fixed;
  top:60px;
  left: 20px;
  justify-content: flex-start;
  align-items: center;
  flex-direction: row;
  padding-left: 26px;
  padding-right: 26px;
}
.leftIcon:active {
  color: #eeeeee;
}
.arricon {
  font-size: 40px;
  font-family: iconfont;
  color: #ffffff;
}
.wrappes {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  right: 0;
  color: #ffffff;
  justify-content: flex-start;
  align-items: center;
}

.emailtitle {
  color: #ffffff;
  font-size: 48px;
  margin-top: 167px;
  height: 200px;
  width: 556px;
  text-align: left;
}

.phonetitle {
  color: #ffffff;
  font-size: 48px;
  margin-top: 167px;
  margin-bottom: 100px;
  width: 556px;
  text-align: left;
}

.input {
  flex: 1;
  height: 60px;
  padding-left: 5px;
  color: #ffffff;
  font-size: 30px;
  background-color: transparent;
}

.inputBox {
  margin-top: 40px;
  height: 80px;
  width: 556px;
  flex-direction: row;
  align-items: flex-end;
  padding-bottom: 2px;
}

.phoneType {
  height: 60px;
  color: #ffffff;
  line-height: 60px;
  font-size: 30px;
  margin-right: 20px;
}

.codeBtn {
  height: 60px;
  color: #ffffff;
  line-height: 60px;
  font-size: 30px;
}

.radioBox {
  flex-direction: row;
  margin-top: 32px;
  justify-content: flex-start;
  align-items: center;
  width: 556px;
  height: 40px;
}

.radio {
  color: #ffffff;
  font-size: 34px;
  margin-right: 20px;
}

.loginType {
  color: #ffffff;
  font-size: 26px;
}

.logintip {
  font-size: 22px;
  margin-top: 32px;
  height: 30px;
  line-height: 30px;
  color: #ffffff;
  margin-bottom: 220px;
}

.logintiphone {
  font-size: 22px;
  margin-top: 32px;
  height: 30px;
  line-height: 30px;
  color: #ffffff;
  margin-bottom: 100px;
}

.singnIn {
  width: 580px;
  height: 80px;
  border-radius: 40px;
  background-color: #ffffff;
  color: #303030;
  text-align: center;
  line-height: 80px;
  font-size: 28px;
  margin-top: 102px;
}

.rowBox {
  flex-direction: row;
  align-items: center;
  justify-content: center;
}

.br {
  border-right-color: #ffffff;
  border-right-width: 1px;
  border-right-style: solid;
}

.bb {
  border-bottom-color: #ffffff;
  border-bottom-width: 1px;
  border-bottom-style: solid;
}

.boxItem {
  font-size: 32px;
  color: #ffffff;
  text-align: center;
}

.ccc {
  color: #cccccc;
}
.mask {
  position: fixed;
  left: 0;
  bottom: 0;
  top: 0;
  right: 0;
  justify-content: center;
  align-items: center;
  background-color: transparent;
}

.indicator {
  width: 40px;
  height: 40px;
}
</style>
